<!--
 * @Description: 意见反馈列表
 * @Version: 1.0
 * @Author: Yuanjy
 * @Date: 2020-05-15 10:31:04
 * @LastEditors: Yuanjy
 * @LastEditTime: 2020-05-15 12:09:16
--> 
<template>
  <div class="app-container">
    <div class="search">
      <el-select v-model="feebbackSource" size="small" placeholder="选择反馈的来源" class="user-input">
        <el-option v-for="item in feebbackSourceList" :key="item.key" :label="item.name" :value="item.key" />
      </el-select>
      <el-button type="primary" size="small" class="el-icon-search" @click="toQuery">搜索</el-button>
      <el-button size="small" class="el-icon-q" @click="cancel">撤销</el-button>
    </div>
    <el-table :data="data" border fit highlight-current-row style="width:100%">
      <el-table-column label="用户id" prop="uid" width="100"></el-table-column>
      <el-table-column label="订单ID" prop="service_id" width="100"></el-table-column>
      <el-table-column label="营养师名称" prop="nutritionist_name" width="100"></el-table-column>
      <el-table-column label="反馈类型" prop="event_type" width="100"></el-table-column>
      <el-table-column label="反馈的内容" prop="content"></el-table-column>
      <el-table-column label="平台" prop="client_platform" width="90"></el-table-column>
      <el-table-column label="手机品牌" prop="client_brand" width="90"></el-table-column>
      <el-table-column label="客户端sdk" prop="client_sdk_version" width="100"></el-table-column>
      <el-table-column label="微信版本" prop="client_version" width="90"></el-table-column>
      <el-table-column label="反馈时间" prop="created_at"></el-table-column>
      <el-table-column label="订单详情" width="100">
        <template slot-scope="scope">
          <i v-if="+scope.row.service_id > 0" class="i-icon icon-check" @click="serviceDetail(scope.row.service_id)"></i>
        </template>
      </el-table-column>
    </el-table>
    <div class="pagination-container">
      <el-pagination
        :current-page.sync="page"
        :page-size="limit"
        :total="total"
        layout="total, prev, pager, next, sizes"
        @size-change="sizeChange"
        @current-change="pageChange" />
    </div>
  </div>
</template>

<script>
import initData from '@/mixins/initData'

export default {
  components: {

  },
  mixins: [initData],
  data () {
    return {
      uid: '',
      listlimit: 20,
      pageall: 1,
      page: 1,
      loading: true,
      total: 0,
      feebbackSourceList: [],
      feebbackSource: '',
      feedlist: {},
      source: ''
    }
  },
  created () {
    this.initParams()
    this.$nextTick(() => {
      this.init()
    })
  },
  methods: {
    beforeInit() {
      this.url = '/admin/v1/feedback'
      const sort = 'id,desc'
      this.params = { page: this.page, limit: this.limit, sort: sort }
      const query = this.query
      const type = query.type
      const value = query.value
      if (type && value) { this.params[type] = value }
      return true
    },
    initParams() {

    },
    toQuery() {
      this.init()
    },
    cancel() {
      this.feebbackSource = ''
    },
    serviceDetail(id) {
      this.$router.push('/order/serviceDetail/' + id + '?tab=user')
    }
  }
}
</script>
<style>
  .search{
    margin-bottom:20px;
  }
</style>
